home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 1 / ACE CD 1.iso / files / utils / acroarex.dms / in.adf / Public_Domain / PD_STUFF.lha / RexxIntuition / RexxIntuition.doc < prev    next >
Encoding:
Text File  |  1992-05-30  |  72.8 KB  |  1,527 lines

  1. THE RX_INTUI.LIBRARY DOC
  2. ------------------------
  3.  
  4. 1.  Copyright and Release Information
  5. 2.  What's the rx_intui.library?
  6. 3.  GetScreen()
  7. 4.  GetWindow()
  8. 5.  EndWindow()
  9. 6.  EndScreen()
  10. 7.  AddMenu()
  11. 8.  AddItem()
  12. 9.  AddSub()
  13. 10. SetMenu()
  14. 11. FreeMenu()
  15. 12. Text()
  16. 13. Erase()
  17. 14. SetDraw()
  18. 15. OpFont(), SetFont(), ClsFont()
  19. 16. AddGadg()
  20. 17. WaitMsg()
  21. 18. ModIDCMP()
  22. 19. SetTime()
  23. 20. ModGadg()
  24. 21. GInfo()
  25. 22. OnOffGadg()
  26. 23. MoveView()
  27. 24. Peek() and Poke()
  28. 25. RedrawWind()
  29. 26. FBox()
  30. 27. Line()
  31. 28. Pixel()
  32. 29. Input()
  33. 30. MsgOne() and MsgThree()
  34. 31. Title()
  35. 32. IFFLoad() and IFFSave()
  36. 33. Color()
  37. 34. SetColor()
  38. 35. Print()
  39. 36. File/String Requester Section
  40. A.  Demo scripts
  41. B.  Rexx Error Returns
  42. C.  Final Notes
  43.  
  44. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  45. 1) Copyright and Release Information
  46.  
  47.    The rx_intui.library and its support files (including this document) are
  48. copyright 1990 by Jeff Glatt of dissidents software. This library and its files
  49. may be freely distributed as long as this copyright notice is intact. Further-
  50. more, if you use this tool, you must never say anything bad about Jeff Glatt,
  51. even if your experimentations with the library result in any aggravation and
  52. provoke pronouncements of extremely naughty words.
  53.  
  54.  
  55. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  56. 2) What's the rx_intui.library? (Or when is this guy gonna do something with
  57.    video? Isn't that why everyone bought an Amiga?)
  58.  
  59.    The rx_intui.library is an ARexx function library. It allows an ARexx macro
  60. script to open screens/windows, and attach gadgets, menus, and open requesters
  61. in those windows. Furthermore, it allows an ARexx macro to interact with
  62. Intuition (ie do an "IDCMP loop"), thus interacting with a user in a familiar,
  63. and friendly windowed environment. In essense, it allows a programmer to write
  64. a Rexx macro with access to the Amiga's intuition library that other languages
  65. offer, but which Bill Hawes' ARexx server does not include.
  66.    There are a few other things that this library can do, but those are its
  67. main features.
  68.    The library cannot be used without Bill Hawes' ARexx package (available
  69. from several distributors).
  70.    Since this is a Rexx function library, any ARexx macro script has automatic
  71. access to the library's functions once the library is added to ARexx. (This can
  72. be accomplished using the dissidents FuncLib program. Copy "rx_intui.library"
  73. to your LIBS: drawer. Consult FuncLib.doc for use of that program.)
  74.  
  75. FuncLib rx_intui.library 0 -30 0
  76.  
  77.    This library requires the dissidents disreq.library file. This is readily
  78. obtained on Fred Fish PD disks, or directly from dissidents. Otherwise, it
  79. should be included on this disk in the DisReq drawer. Copy it to LIBS:
  80.    For certain other functions, this library requires other dissidents libs,
  81. but only for those particular functions (as noted).
  82.    There are many example scripts included, and a section of this document
  83. describes them.
  84.     NOTE: All library names MUST begin with "rxi_". For example, GetScreen
  85. would be used as rxi_GetScreen. The case is not important. This prefix is
  86. eliminated in the descriptions, but remember to use it in your scripts or
  87. you will get an ARexx "Function not found" error!
  88.  
  89.  
  90. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  91. 3) GetScreen()
  92.  
  93.    To open a custom screen, you use this function:
  94.  
  95. screen = GetScreen(title,mode,left,top,width,height,depth)
  96.  
  97.    title  - the text displayed in the screen's titlebar (default = NONE)
  98.    mode   - the screen's ViewModes (default = HIRES) as follows:
  99.             LORES = 0, HIRES = 32768, LACE = 4, HAM = 2048, HALFBRITE = 128
  100.             DUALPF = 1024, GENLOCK VIDEO = 2, SPRITES = 16384, PFBA = 64
  101.             Simply add up the ones that you want.
  102.    left   - the upper left x position (default = 0)
  103.    top    - the upper left y position (default = 0)
  104.    width  - the width of the screen in pixels (default = Gfx's Normal Columns)
  105.    height - the height of the screen in pixels (default = Gfx's Normal Rows)
  106.    depth  - the number of bitplanes (ie colors) (default = 3, ie 8 colors)
  107.  
  108.    If you don't specify an argument, (ie just the comma without any value),
  109. then you'll get a default value. For example, here I open a HIRES 16 color
  110. screen with a title of "My Screen". Note that the default width and height will
  111. be set by the lib, and takes into account PAL as well as Interlace (if I
  112. specify LACE mode).
  113.  
  114. screen = GetScreen('My Screen',,,,,,4)
  115.  
  116.    This returns the address of the custom screen (which will be passed to other
  117. lib functions), or '' if the screen didn't open.
  118.    For all other lib functions that require the screen address to be passed,
  119. if '', then that function will do nothing or ignore this argument. This insures
  120. that if your screen doesn't open, you can't accidentally perform operations on
  121. a null pointer (ie all lib functions are always "safe" to call).
  122.    The lib will clip the screen's width and height no larger than the Normal
  123. Columns and Rows set by the graphics library.
  124.  
  125.  
  126. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  127. 4) GetWindow()
  128.  
  129.    To open a window, you use this function:
  130.  
  131. window = GetWindow(title,screen,left,top,width,height,extra,IDCMP,windFlags)
  132.  
  133.    title  - the text to appear in the window titlebar
  134.    screen - the screen upon which to open this window (default = WorkBench)
  135.    left   - the upper left x position (default = 0)
  136.    top    - the upper left y position (default = 0)
  137.    width  - the width of the window in pixels (default = screen's width)
  138.    height - the height of the window in pixels (default = screen's height)
  139.    extra  - these are the extra IDCMP flags for the window as follows:
  140.          CONVERT_RAW = 8    RAWKEY are converted to special COOKED KEY events
  141.          NO_SLEEP    = 16   If no msgs at window, returns instead of sleeps
  142.          GIMME_UP    = 32   Let's you hear about UP mousebutton events
  143.          NO_COLLECT  = 64   Reports each MOUSEMOVE instead of collecting them
  144.          GIMME_MOVE  = 128  Allows you to hear about MOUSEMOVE events
  145.          Simply add up the ones that you want. (default = none)
  146.    IDCMP  - the classes of Intuition messages which you want to receive
  147.             SIZEVERIFY = 1, NEWSIZE = 2, REFRESHWINDOW = 4, MOUSEBUTTONS = 8
  148.             MOUSEMOVE = 16, GADGETDOWN = 32, GADGETUP = 64, REQSET = 128
  149.             MENUPICK = 256, CLOSEWINDOW = 512, RAWKEY = 1024, REQVERIFY = 2048,
  150.             REQCLEAR = 4096, MENUVERIFY = 8192, NEWPREFS = 16384, DISKINSERTED
  151.             = 32768, DISKREMOVED = 65536, WBMESSAGE = 131072, ACTIVEWINDOW =
  152.             262144, INACTIVEWINDOW = 524288, DELTAMOVE = 1048576, TIMEOUT =
  153.             4194304 (TIMEOUT allows the WaitMsg routine to return after a
  154.             certain amount of time without user activity.)
  155.             Simply add up the ones that you want. (default = MOUSEBUTTONS,
  156.             GADGETDOWN, GADGETUP, MENUPICK, CLOSEWINDOW, and if you add a
  157.             proportional gadget MOUSEMOVE).
  158.    windFlags - the window flags as follows:
  159.             SIZE = 1, DRAG = 2, DEPTH = 4, CLOSE = 8, SIZEBRIGHT = 16, SIZE-
  160.             BOTTOM = 32, SIMPLE_REFRESH = 64, SUPER_BITMAP = 128, OTHER_REF =
  161.             192, BACKDROP = 256, REPORTMOUSE = 512, GIMMEZERO = 1024, BORDER-
  162.             LESS = 2048, ACTIVATE = 4096, RMBTRAP = 65536, NOCARE_REF = 131072,
  163.             SMART_REFRESH = 0
  164.             Simply add up the ones that you want. (default = SMART_REFRESH,
  165.             SIZE, DRAG, DEPTH, CLOSE, ACTIVATE, REPORTMOUSE)
  166.  
  167.    If you don't specify a parameter, then you'll get the default value. For
  168. example, here I open a window with no title on WorkBench. The lib will open
  169. the screen to full Workbench width and height (taking PAL into account).
  170. I get the default IDCMP and system gadgets.
  171.  
  172. window = GetWindow(,,,,,,,,,)
  173.  
  174.    This returns the address of the window (which will be passed to other
  175. lib functions), or '' if no window opened. If passed a screen of '', then it
  176. opens on WorkBench.
  177.  
  178.    For all other lib functions that require the window address to be passed,
  179. if '', then that function will do nothing.
  180.  
  181.    Note that when opening on WorkBench, this library expects the system font
  182. to be an 8 by 8 pixel font. If you open a window on a custom screen, the user's
  183. Preferences font setting no longer has to be set to an 8 by 8 font.
  184.    The lib will automatically clip the window's width and height to no larger
  185. than the screen upon which it is opened.
  186.  
  187.  
  188. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  189. 5) EndWindow()
  190.  
  191.    To close an opened window, simply call
  192.  
  193. window = EndWindow(window)
  194.  
  195.    where window is the address returned by GetWindow(). This automatically
  196. frees all menus and gadgets that you attached to the window. If window = '',
  197. then this does nothing. You should save the return back into the variable
  198. that you used with GetWindow. This ensures that it's safe to do repeated
  199. EndWindow calls on the same pointer.
  200.  
  201.  
  202. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  203. 6) EndScreen()
  204.  
  205.    To close an opened screen, simply call
  206.  
  207. screen = EndScreen(screen)
  208.  
  209.    where screen is the address returned by GetScreen(). You should first close
  210. all windows open on the screen. If screen = '', then this does nothing.
  211.  
  212.  
  213. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  214. 7) AddMenu()
  215.  
  216.   To add a menu to an opened window, use this
  217.  
  218. menu = AddMenu(window,text,leftedge,width)
  219.  
  220.   window   - the window address as returned by GetWindow()
  221.   text     - the name of the menu (placed in the titlebar)
  222.   leftedge - how many pixels from the left window border to place the menu
  223.   width    - the width of the menu (in pixels)
  224.  
  225.   This will add a new menu to the window, so that you can start adding menu
  226. items to it. The first menu attached to the window will be menu #0. The second
  227. menu added will be #1, etc.
  228.   You should make the width as big as the width of the largest item name to be
  229. added to the menu, or the menu name itself (whichever is bigger). To calculate
  230. the width of an item or menu name, add 8 pixels for each character in the name.
  231. For example, if your menu name is "Project", the width would be 7 chars * 8 =
  232. 15 pixels wide. If you don't specify the width or leftedge, the library sets
  233. the width to the menu's name, and places it after the last added menu (ie
  234. automatically places the menu in a sensible position).
  235.   For example, here I add a menu called "Blort" and let the lib position it:
  236.  
  237. menu0 = AddMenu(window,'Blort',,)
  238.  
  239.   This returns the address of the added menu. If it can't be added, '' is
  240. returned. This does nothing if window is ''.
  241.  
  242.  
  243. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  244. 8) AddItem()
  245.  
  246. item = AddItem(menu,text,flags,exclude,IDCMP,commseq,window)
  247.  
  248.   This adds an item to a menu. The first item added is Item #0. The second
  249. item added is #1, etc. The lib automatically positions the item in the menu.
  250. You can add several items to a menu.
  251.  
  252.   menu    - the menu that the item is added to, as returned by AddMenu()
  253.   text    - the item's name
  254.   flags   - the item's flags are as follows:
  255.             CHECKIT = 1 (Put a checkmark before the item when it's selected)
  256.             CHECKED = 256 (Put the checkmark there now)
  257.             TOGGLECHECK = 8 (Each time its selected, toggle the checkmark)
  258.             COMMSEQ = 4 (Allow a Right Amiga key combo to select the item)
  259.             HIGHBOX = 128 (Highlight by boxing the item)
  260.             HIGHNONE = 192 (Don't highlight the item)
  261.             Simply add up the ones you want. (default = none of the above)
  262.   exclude - a mask of the other items to exclude when this one is selected
  263.             (default = no exclude)
  264.   IDCMP   - Extra flags that specify how the item effects IDCMP:
  265.             ISSUE CLOSE = 128 (This item sends a CLOSEWINDOW message when
  266.                                selected)
  267.             OK = 1 (CLOSEWINDOW state is OK as opposed to CANCEL)
  268.   commseq - the character to use in conjunction with the right Amiga key
  269.             (default = no commseq). Note that you should also set the COMMSEQ
  270.             flag as well.
  271.   window  - the window in which the menu was added, as returned by GetWindow()
  272.  
  273.   This returns the address of the added item so that you can add subitems to
  274. it. If it can't be added, '' is returned. If the menu or window = '', then this
  275. does nothing.
  276.  
  277.  
  278. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  279. 9) AddSub()
  280.  
  281. sub = AddSub(item,text,flags,exclude,IDCMP,commseq,window)
  282.  
  283.   This adds a subitem to an item. The first sub added is Sub #0. The second
  284. sub added is #1, etc. The lib automatically positions the subitem by its item.
  285. You can add several subitems to an item. The args are the same as AddItem()
  286. except that you pass the item to which to add the Sub, as returned by AddItem.
  287.  
  288.   This returns the address of the added subitem. If it can't be added, '' is
  289. returned. If the item or window = '', then this does nothing.
  290.  
  291.  
  292. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  293. 10) SetMenu()
  294.  
  295. oldMenu = SetMenu(window,newMenu)
  296.  
  297.   window  - the window to set the new menu strip in
  298.   newMenu - the address of menu #0 of the strip to be installed (if '' or no
  299.             arg, then a new strip is not installed)
  300.  
  301.   A menu strip is a series of menus that you added to the window.
  302.   This removes any menu strip that is presently installed in the window, and
  303. returns the address of its menu #0. Note that the old menu strip is not freed.
  304. If no previous strip was installed, it returns ''.
  305.   If you want to make several different menu "strips" for a window, and swap
  306. them at different times, use this function. The technique is to make menus
  307. using AddMenu(), AddItem(), and AddSub(). Save the address of the first menu
  308. (#0) installed. This is also the address of your strip since all the menus
  309. added together are linked to each other in the order that they were added.
  310. Now, call
  311.  
  312. oldMenu = SetMenu(window,,)
  313.  
  314. This clears out the window's strip so that you can now make a new strip of
  315. menus. Save the address of this new strip's menu #0. Now, when you want to
  316. swap strips, pass the address of the strip to install via SetMenu. Later, you
  317. will need to free the strips.
  318.  
  319.  
  320. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  321. 11) FreeMenu()
  322.  
  323. menu = FreeMenu(window)
  324.  
  325.   When you EndWindow(), the menu strip that is presently attached to the
  326. window is automatically freed (so you don't have to use this function if you're
  327. using only 1 menu strip.) On the other hand, any other strips that you made
  328. which are not currently attached, must be eventually freed using FreeMenu().
  329. Pass the address of menu #0 of the strip to free (ie the address of the strip).
  330.   Technique: FreeMenu the current menu, then SetMenu/FreeMenu for every other
  331. menu strip that you created. Then, you can close the window. DON'T EndWindow
  332. before freeing its menus.
  333.  
  334.  
  335. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  336. 12) Text()
  337.  
  338. err = Text(text,window,x,y)
  339.  
  340.    This prints the passed text to the window at position (x,y).
  341.  
  342.    text   - the text to print
  343.    window - the window in which to print
  344.    x      - x position in pixels
  345.    y      - y position in pixels
  346.  
  347.    Uses the current penA color for the text, and the penB color for the back-
  348. ground behind the text, and the current drawmode. If window = '', it does
  349. nothing. If text = '' or no arg, then it just moves the pen position to (x,y).
  350. If x or y = '' or no arg, then that position is not changed. (Note that no
  351. args for both x and y allows you to print text from where you last left off.)
  352. The standard text font height is 8 pixels (for Topaz 8).
  353.  
  354.  
  355. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  356. 13) Erase()
  357.  
  358. err = Erase(charLength,window,x,y)
  359.  
  360.    This erases an area of the current text height at position (x,y). charLength
  361. is the number of characters to erase. The other args are as in Text().
  362.  
  363.  
  364. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  365. 14) SetDraw()
  366.  
  367. err = SetDraw(window,PenA,PenB,DrawMode)
  368.  
  369.    window   - in which to set the pens and mode
  370.    PenA     - the color # used for the text or line drawing (generally)
  371.    PenB     - the color # used for the background behind the text or line
  372.    DrawMode - determines how the pens are used:
  373.               JAM1 = 0 (Use only PenA), JAM2 = 1 (Use both pens), COMPLEMENT =
  374.               2 (Use complementary color #s), INVERSVID = 4 (reverse the pens)
  375.  
  376.    You should set the pens and drawmode before you start calling Text() or
  377. Erase() (unless you want the defaults of JAM1, PenA = 3, and PenB = 0). You
  378. change text/drawing colors and modes using this function.
  379.  
  380.  
  381. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  382. 15) OpFont(), SetFont(), ClsFont()
  383.  
  384. FontPtr=OpFont(style,size,fontname)
  385.  
  386.    style    - 0=NORMAL, 1=BOLD, 2=ITALICS, 4=UNDERLINE
  387.    size     - the font height (i.e. 8 pixels)
  388.    fontname - name of the font to open (i.e. garnet.font)
  389.  
  390.    Opens the passed font of the specified name, size, and style. Returns the
  391. FontPtr or '' if error. If size = '', defaults to 8. If style = '', defaults
  392. to NORMAL. You must open a font before you can SetFont(). This does not change
  393. the window's current font or style. Note that you can combine styles. For
  394. example, if you want BOLD and ITALICS, specify style = 1+2. If the fontname
  395. is omitted, this returns the Topaz 8 default FontPtr (for use with SetFont).
  396. You should NEVER ClsFont() on the default Topaz 8!
  397.  
  398. err=SetFont(window,style,FontPtr)
  399.  
  400.    window   - in which to set the font
  401.    style    - 0=NORMAL, 1=BOLD, 2=ITALICS, 4=UNDERLINE
  402.    FontPtr  - as returned from OpFont()
  403.  
  404.    Sets the passed FontPtr as the current. If FontPtr = '', doesn't change the
  405. font. Also sets the passed style. If style = '', defaults to NORMAL. By passing
  406. only the style, you can change styles without changing the font.
  407.  
  408. FontPtr=ClsFont(window,FontPtr)
  409.  
  410.    Closes the passed font and returns a NULL string. You should reassign the
  411. return to the same variable as passed so that multiple ClsFonts are safe.
  412.  
  413.  
  414. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  415. 16) AddGadg()
  416.  
  417. gadg=AddGadg(window,type,text,left,top,width,height,activation,ID,IDCMP,extra)
  418.  
  419.    This adds a gadget to the opened window at the specified position. You can
  420. add Proportional, String, or Boolean gadgets. Proportional gadgets are laid on
  421. their side (along the x axis) with a knob that moves left or right and a con-
  422. tainer of the size specified by width and height. String and Boolean gadgets
  423. have a border around them of the size specified by width and height (in pixels).
  424. Gadgets are placed at a position of pixel offsets from the top and left of
  425. the window's upper left corner (left = 0, top = 0). The passed text is printed
  426. to the left of the prop and string gadgets (so be sure to calculate the text
  427. width using Number of characters * 8, and add this to your desired left posi-
  428. tion.) For Bool gadgets, the text is printed (and centered) inside the gadget
  429. border (so be sure to make the gadget width as big as the text width).
  430.  
  431.    window    - in which to place the gadget (If '', then this does nothing)
  432.    type      - BOOL = 1, PROP = 3, STRING = 4
  433.    text      - string associated with the gadget. If no arg, then no gadg text
  434.    left      - # of pixels over from the left window border
  435.    top       - # of pixels down from the top of window
  436.    width     - the width of the gadget. For Bools, make this at least as big
  437.                as your text width (ie Number of characters * 8). For Props or
  438.                strings, any size will do (however long you want the gadg to be)
  439.    height     - The height of the gadget. This should be at least 12 pixels
  440.    activation - What intuition sends when the user selects, uses, and de-
  441.                 selects the gadget:
  442.                 RELVERIFY = 1 (Send a message when the user is done using it)
  443.                 IMMEDIATE = 2 (Send a message when user first starts using it)
  444.                 ENDGADGET = 4 (Send a REQCLEAR IDCMPspec when done)
  445.                 RIGHTBORD = 16 (Place the gadg inside the window right border)
  446.                 LEFTBORD = 32 (Place the gadg inside the window left border)
  447.                 TOPBORD  = 64 (Gadg in top border, title bar)
  448.                 BOTTOMBORD = 128 (in bottom border)
  449.                 TOGGLE = 256 (Each time user selects, toggle its ON/OFF state)
  450.                 STRCENTER = 512 (String Gadg - cursor stays in center of gadg)
  451.                 STRRIGHT = 1024 (String Gadg - cursor stays at right of gadg)
  452.                 Simply add up the ones you want
  453.    ID         - A number from 0 to 999 which you want associated with this
  454.                 gadget. Each gadget should have a unique ID number.
  455.    IDCMP      - Extra flags that specify how the gadget affects IDCMP:
  456.                 ISSUE_CLOSE = 128 (This gadget sends a CLOSEWINDOW message when
  457.                                   selected or released depending upon RELVERIFY
  458.                                   and IMMEDIATE. String gadgs only send on RELVERIFY)
  459.                 OK         = 1 (CLOSEWINDOW state is OK as opposed to CANCEL)
  460.                 AUTOSELECT = 2  For a string gadget, when the user hits RETURN,
  461.                              the next string gadget in the window is automatic-
  462.                              ally selected. You must specify RELVERIFY for this
  463.                              to work. Add the string gadgets in the order that
  464.                              you would like them to be selected, and set the
  465.                              AUTOSELECT of each string gadget that is to be
  466.                              autoselected. A string gadget without this flag
  467.                              set cannot be autoselected, nor auto select any
  468.                              other gadgets in the window.
  469.                 PRINTPROP  = 4  For a prop gadget, prints the value of the
  470.                              knob position as the user moves it. The value is
  471.                              printed to the left of the gadget, so you should
  472.                              leave 48 pixels space between gadgets along the
  473.                              x axis. For this to work properly, you should
  474.                              specify RELVERIFY and IMMEDIATE for the activation.
  475.                              Also, the window's extraIDCMP should NOT be
  476.                              NO_COLLECT or GIMME_MOVE.
  477.    extra      - For a string gadget, this is the number of maximum chars, MAX-
  478.                 CHARS that you want the user to be able to type in (limit =
  479.                 65525).
  480.                 For a prop, this is the number of possible pot values, RANGE,
  481.                 that you would like returned. For example, if you want only 4
  482.                 different values returned (ie 0, 1 ,2, or 3), then pass a 4.
  483.                 The largest # of values you can receive is 65,535 (0 to 65,535
  484.                 range). Note that a range of 1 (or 0), makes a knob that fills
  485.                 the entire prop (and cannot be moved) which always returns 0.
  486.                 For a Bool, this is the initial selected STATE (1=On, 0=Off).
  487.  
  488.    The gadget border and text is rendered using the current PenA, PenB, and
  489. DrawMode, so you should set these values as desired before you add gadgets.
  490. Note that the border and knob for Prop gadgets is set by Intuition based upon
  491. your window's BlockPen, and so you have control over only the text color with
  492. props. All of the prop borders/knobs must be the same pen color number. Note
  493. that you could change this using the Poke() command on the window structure
  494. from GetWindow() as so:
  495.  
  496. /* set window's BlockPen to pen #3 */
  497. pen=3
  498. value = POKE(pen,window,99,0)
  499.  
  500. This should be done before any AddGadg(), and will also affect menu colors.
  501.    Note: Adding a prop gadget with the PRINTPROP flag set may cause the
  502. window's DrawMode, FontPtr, and Style to be changed when the user selects the
  503. gadget. The font is changed to Topaz 8 NORMAL and Drawmode = JAM2.
  504.  
  505.  
  506. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  507. 17) WaitMsg()
  508.  
  509. IDCMPspec=WaitMsg(window)
  510.  
  511.    This routine is the main function which drives your IDCMP loop. It gets
  512. the next intuition message that has arrived at your window, and puts the info
  513. into a form that your rexx script can deal with. If there is no message at the
  514. window, then your Rexx script is put to sleep until one arrives. The returned
  515. IDCMPspec is a Rexx Argstring which consists of 4 fields. You can use the
  516. standard Rexx command PARSE to place the 4 fields into separate variables.
  517. Note that you only receive messages for those IDCMP flags you set when you
  518. GetWindow() or ModIDCMP(). The first field of the IDCMPspec is the class. This
  519. tells you what type of message was received. For example, if you accept the
  520. default window IDCMP when you GetWindow() and you add some menus, when the
  521. user selects some menu item (or subitem), you'll receive an IDCMPspec whose
  522. first field is the value 2 for MENUPICK. If the user were to click the right
  523. mouse (SELECT) button, the returned IDCMPspec's class would be 3 for MOUSE-
  524. BUTTON. The other 3 fields of the IDCMPspec have different meanings depending
  525. upon what the class is. Here is a chart detailing what the fields are for all
  526. IDCMP flags (events):
  527.    A ---- means that this field has no meaning.
  528.  
  529.    flag          CLASS          FIELD #2          FIELD #3           FIELD #4
  530.  
  531. CLOSEWINDOW        0      state: 0=CANCEL,1=OK      ----               ----
  532.  
  533. GADGET             1            ID number        0=DOWN (SELECT)   For PROPs, this is the current step # of the knob
  534.                                                  1=UP (RELEASE)    For STRINGS, this is the entered text
  535.                                                                    For BOOLS, this is the On/Off state (On=1, Off=0)
  536.  
  537. MENUPICK           2             MENU #              ITEM #           SUBITEM # (if there is one)
  538.  
  539. MOUSEBUTTON        3         Left DOWN=0         x pixel position   y pixel position
  540.                              Left UP=1
  541.                              Right (Menu) DOWN=2
  542.                              Right UP=3
  543.    Note that in order to receive Menu buttons, you must specify RMBTRAP window flags.
  544.    To receive any UP button event, you must set GIMME_UP of the extraIDCMP flags
  545.    for the window.
  546.  
  547. MOUSEMOVE          4         x pixel position     y pixel position       ----
  548.    If DELTAMOVE, then x and y are a (signed) delta offset from the last position.
  549.    Note that in order to receive MOUSEMOVE, you must specify GIMME_MOVE of the
  550.    extraIDCMP flags for the window. Also, NO_COLLECT will affect whether you
  551.    receive moves while the user is moving the mouse, or whether you just receive
  552.    notice of his final position (where he stops moving the mouse). NO_COLLECT
  553.    is VERY intensive with Rexx and should only be used when you want the user
  554.    to do something like freehand drawing with the mouse.
  555.  
  556. RAWKEY            5       If RAW, this is Code.     If RAW, this         ----
  557.                           If COOKED, this is an     the qualifier.
  558.                           extended ascii char.      If COOKED, this is
  559.                                                     the modifier.
  560.    Note that to get the extended ascii char (ie COOKED KEYS), you must set
  561.    CONVERT_RAW of the extraIDCMP flags for the window. This translates a
  562.    RAWKEY press into a single ascii character. For all keys except the cursor,
  563.    function, and help keys, the ascii character is whatever the system keymap
  564.    returns, and the modifier = 0. So if the user holds the shift key and
  565.    presses the f key, 'F' is the char and modifier = 0. Alt keys may return
  566.    special chars. For the Function, cursor, and help keys, the values returned
  567.    are as follows:
  568.    Functions F1 to F10 = 0 to 9
  569.    Up cursor = 10
  570.    Down cursor = 11
  571.    Right cursor = 12
  572.    Left cursor = 13
  573.    Help = 14
  574.  
  575.    Furthermore, the modifier for these keys will be:
  576.    no ALT and no SHIFT = 1
  577.    SHIFT = 2
  578.    ALT = 4
  579.  
  580.    Note that CONVERT_RAW ignores key releases.
  581.  
  582. REQ              6        If REQSET, -1                ----               ----
  583.                           If REQVERIFY, 0
  584.                           If REQCLEAR, 1
  585.  
  586. SIZE             7        If SIZEVERIFY, -1            ----               ----
  587.                           If NEWSIZE, 0
  588.                           If REFRESHWINDOW, 1
  589.  
  590. DISK             8        If INSERTED, 0               ----               ----
  591.                           IF REMOVED, 1
  592.  
  593. ACTIVE           9        If ACTIVEWINDOW, 0           ----               ----
  594.                           If INACTIVE, 1
  595.  
  596. TIMEOUT         10           ----                      ----               ----
  597.  
  598. MENUVERIFY      11           ----                      ----               ----
  599.  
  600. NEWPREFS        12           ----                      ----               ----
  601.  
  602. WBMSG           13           ----                      ----               ----
  603.  
  604.    Here's the way I envision that you'll implement your IDCMP loop in Rexx
  605. (ie receive and interprete events from intuition). You'll open a window and
  606. setup some way for the user to close the window (ie a system CLOSEGADGET, one
  607. of your gadgets set to ISSUE_CLOSE, or a menu item set to ISSUE_CLOSE). You'll
  608. initially set a variable (in this example called class) to 1. Then, you'll
  609. enter a big loop where you WaitMsg(), and process all received IDCMPspecs
  610. until you receive a class of 0 (CLOSEWINDOW). This will knock you out of the
  611. loop, and allow your program to terminate. Furthermore, you can examine the
  612. 2nd field of the CLOSEWINDOW (its state), to determine whether the user wants
  613. to do one thing (OK), or something else (CANCEL). The system CLOSEGADGET always
  614. returns CANCEL state, but you can set your own menu items or gadgets to return
  615. either OK or CANCEL state. Here's an example script:
  616.  
  617. /* An example of using the dissidents rx_intui.library */
  618.  
  619. /* Open a window on WB with default IDCMP, windowFlags, etc. */
  620. wind=rxi_GetWindow('My Window',,,,,,,,)
  621.  
  622. /* Here's our IDCMP loop. We just print all returned specs until we get */
  623. /* CLOSEWINDOW class (0). Start out class = 1 before we get into the loop. */
  624. class = 1
  625. DO WHILE class > 0
  626.  
  627. /* Get the next event or go to sleep waiting for one */
  628. spec=rxi_WaitMsg(wind)
  629.  
  630. /* Show what was returned. Could be right MOUSEBUTTON (down) or CLOSEWINDOW */
  631. SAY spec
  632.  
  633. /* divide the spec into 4 separate variables */
  634. PARSE var spec class part1 part2 part3
  635.  
  636. /* Here we would examine the class and do other things depending on it */
  637.  
  638. END
  639.  
  640. /* Close the window, thus freeing any resources for it. */
  641. /* Note that if no window opened, this does nothing. */
  642. wind=rxi_EndWindow(wind)
  643.  
  644.  The TIMEOUT event allows the WaitMsg routine to return after a certain amount
  645. of time without user activity. You can set the TIMEOUT value from 0 to 255
  646. ticks. There are approximately 10 ticks per second but this depends upon system
  647. activity. So, a timeout value of 20 allows the WaitMsg() routine to wait about
  648. 2 seconds for any user activity before it returns with a TIMEOUT IDCMPspec.
  649. Note that you must set the TIMEOUT flag for your window IDCMP. Also, note that
  650. every time that you call WaitMsg(), the TIMEOUT is restarted. To disable or
  651. enable TIMEOUT, use SetTime(). This feature is useful if you want to have your
  652. IDCMP loop do something automatically on a regular basis. If not for TIMEOUT,
  653. when you called WaitMsg() and there were no messages from the user, WaitMsg()
  654. would put your macro to sleep until the user intervened. This way you can
  655. always return from WaitMsg() on a regular basis. There is only one problem with
  656. this scheme. The TIMEOUT only works if the window is active. If the user were
  657. to select some other window, then WaitMsg() really will go to sleep if no user
  658. activity. You could let the user take advantage of this as a way for him to
  659. completely halt your entire Rexx script at will. Or, you could ask to receive
  660. ACTIVEWINDOW and INACTIVEWINDOW. There is another flag (of the window's
  661. extraIDCMP) called NO_SLEEP. This flag allows WaitMsg() to never sleep. Instead,
  662. WaitMsg() returns a TIMEOUT event (if there is no user activity in that
  663. window). The net result is a busy wait loop on the Amiga, but if you wanted
  664. some process to continually grind away, even when the user activates another
  665. window, you should set NO_SLEEP when you receive an INACTIVEWINDOW IDCMPspec.
  666. Later, when you receive an ACTIVEWINDOW IDCMPspec, you'll know that the user
  667. selected the window again, and you can clear NO_SLEEP (via ModIDCMP). Note that
  668. a TIMEOUT value of 0 really means 256 (ie 25.6 seconds which is the longest
  669. automatic timeout possible). With NO_SLEEP set, the TIMEOUT amount of 0 means
  670. to return immediately. Otherwise, there is a Delay before the return. Normally,
  671. you'll want some sort of delay to prevent the program from hogging CPU.
  672.  
  673.    Note: If the user selects a prop gadget with the PRINTPROP flag set, this
  674. may cause the window's PenA, PenB, DrawMode, FontPtr, and Style to be changed.
  675. You may need to restore these as desired when you detect such a prop in use.
  676. The font is changed to Topaz 8 NORMAL, Drawmode = JAM2, and pens are set to
  677. the gadget's.
  678.  
  679.    If window = '', then this just returns CLOSEWINDOW with a CANCEL state.
  680.  
  681.  
  682. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  683. 18) ModIDCMP()
  684.  
  685. err=ModIDCMP(window,extra,IDCMP,windFlags)
  686.  
  687.     This is used to change the IDCMP and window flags of an open window. You
  688. can change the extraIDCMP and IDCMP flags as described in GetWindow(). For
  689. the windFlags, the only values that can be changed are RMBTRAP or NOCARE-
  690. REFRESH (ie to turn RMBTRAP on and NOCAREREFRESH off, windFlags = 65536, to
  691. turn it off as well as NOCAREREFRESH, windFlags = 4096).
  692.  
  693.    Note: Modifying a prop gadget with the PRINTPROP flag set may cause the
  694. window's PenA, PenB, DrawMode, FontPtr, and Style to be changed.
  695.  
  696.  
  697. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  698. 19) SetTime()
  699.  
  700. err=SetTime(window,timeout)
  701.  
  702.    This is used to set the timeout value in ticks (where each tick is about
  703. 1/10 of a second). If you pass a specific timeout value, then timeout is
  704. enabled. If you pass no timeout arg (ie an empty comma), then timeout is
  705. disabled.
  706.    For example, this sets a timeout of 1 second, enabling the feature:
  707.  
  708. err=SetTime(window,10)
  709.  
  710.    This disables the timeout feature completely:
  711.  
  712. err=SetTime(window,)
  713.  
  714.  
  715. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  716. 20) ModGadg()
  717.  
  718. gadg=ModGadg(window,gadg,text,activation,extra,init,ID,IDCMP,PenA,PenB,DrawMd)
  719.  
  720.    This is used to modify a gadget in a window. You can change the following
  721. parameters:
  722.  
  723.   text       - the text associated with the gadget. The new string cannot be
  724.                longer than the original string used when the gadget was made
  725.                (via AddGadg), or it will be truncated to that length. If you
  726.                pass no arg for this, then it is not changed.
  727.   activation - same as AddGadg(). If no arg, then it is not changed.
  728.   extra      - same as AddGadg(). If no arg, then it is not changed.
  729.                Note that for a string gadget, the number of chars cannot be
  730.                larger than the original value when the gadget was made. If so,
  731.                the value is unchanged.
  732.   THE NEXT 3 VALUES DO NOT APPLY TO THE BORDER OF A PROP GADGET.
  733.   PenA       - the new PenA value for the text and border. If no arg, it is
  734.                unchanged.
  735.   PenB       - the new PenB value for the text and border. If no arg, it is
  736.                unchanged.
  737.   DrawMd     - the new draw mode value for the text and border. If no arg, it
  738.                is unchanged.
  739.   init       - For a string gadget, this is the text to set inside the gadget.
  740.                If the text is longer than the gadget's maximum chars, it will
  741.                be truncated.
  742.                For a prop gadget, this is the step # upon which to set the
  743.                knob. For our preceding example, we set a RANGE of 4. Now, we
  744.                pass a value of 0, 1, 2, or 3. 0 would set the knob all the way
  745.                to the left, 3 would set it all the way to the right. The lib
  746.                does no error checking that your step # is one of the allowable
  747.                ranges, so a "wrap-around" effect may occur if you don't check.
  748.                For a Bool, this is ignored.
  749.   ID         - same as AddGadg(). If no arg, then it is not changed.
  750.   IDCMP      - same as AddGadg(). If no arg, then it is not changed.
  751.  
  752.    Note that when you first AddGadg(), you should make sure that your text,
  753. (and for a STRING gadget, the MAXCHARS), is as large as any string that you
  754. intend to pass to ModGadg() so that no truncation will occur.
  755.    If window or gadg = '', this does nothing.
  756.    Note: This routine may change the current PenA, PenB, and DrawMode if you
  757. update a PROP gadget's knob position with the PRINTPROP flag set.
  758.  
  759.  
  760. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  761. 21) GInfo()
  762.  
  763. value=GInfo(window,ID)
  764.  
  765.     This gets some info about the gadget with the passed ID. If the gadget
  766. with that ID is a Prop, this returns the step # that the knob is on. For a
  767. Bool, this returns its state (1=On,0=Off). For a string, this returns the
  768. text in the gadget. If window = '', or no gadget is found with the passed
  769. ID, this returns a null string.
  770.  
  771.  
  772. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  773. 22) OnOffGadg()
  774.  
  775. gadg=OnOffGadg(window,gadg,operation)
  776.  
  777.    This is used to turn a gadget On or Off, activate it, or to remove it
  778. altogether. If removed, it is freed. If passed a null window or gadg ptr, this
  779. does nothing.
  780.  
  781.    window    - the address of the window that the gadg is in
  782.    gadg      - the address of the gadg to affect (as returned by AddGadg)
  783.    operation - 0 for remove it, 1 for ON, 2 for OFF, 3 for activate it
  784.  
  785.    Note that this returns the address of the gadget if you are turning it ON
  786. or OFF, but it returns a NULL ptr if you remove the gadget. You should always
  787. assign the return to the same variable name as the passed gadget. This will
  788. insure that multiple calls to remove a certain gadget will be "safe".
  789.    If activating a string gadget, the cursor will appear in the string gadget
  790. and the user will be able to start typing without having to click in the
  791. gadget first. If another string gadget is currently active, this won't unhigh-
  792. light that gadget. You may need to do that manually by clearing the SELECTED
  793. bit of the gadget and then refreshing the window that the gadget is in as so:
  794.  
  795. value = PEEK(gadg,13,0)
  796. value = value AND '7f'x    /* clear selected bit. OR'ing with '80'x sets it */
  797. value = POKE(value,gadg,13,0)
  798. err = RedrawWind(wind,8)
  799.  
  800.    Note that Intuition's handling of gadget highlighting is very susceptible to
  801. race conditions when your application changes any SELECT bits after an activate
  802. or refresh of gadgets. You may need delays to give the OS time to do its thing.
  803.    If window or gadg = '', this does nothing.
  804.  
  805.  
  806. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  807. 23) MoveView()
  808.  
  809. err=MoveView(window,operation,data1,data2)
  810.  
  811.    This is used to move or size a window (or a window's screen). It is also
  812. used to beep (ie flash) the screen, or to activate a window. If window is null,
  813. this does nothing. No error checking is performed on the dx and dy values!
  814.  
  815. operation is 0=WindowToFront,1=ScreenToFront,2=WindowToBack,3=ScreenToBack,
  816.              4=ActivateWindow,5=DisplayBeep,6=SizeWindow,7=MoveScreen,
  817.              8=MoveWindow
  818. data1 and data2 are dx,dy if operation = MoveWindow, MoveScreen, or SizeWindow.
  819. Ignored otherwise.
  820.  
  821.  
  822. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  823. 24) Peek() and Poke()
  824.  
  825. value = PEEK(address,offset,size)
  826. value = POKE(value,address,offset,size)
  827.  
  828.    address = structure address to examine or modify
  829.    offset  = # of bytes to the desired field from the head of the structure
  830.    size    = 0 if the field is a BYTE size, 1 for WORD, or 2 for LONG
  831.    For POKE,
  832.    value   = the new value to install in that field
  833.  
  834.    These 2 routines let you modify or inspect fields of the structures that the
  835. lib returns. For example, you may wish to get the Window's RastPort address.
  836. This can be done by PEEKing the value at an offset of 50 bytes from the window
  837. address. (The window address is returned by GetWindow). Since the RastPort
  838. field of the window contains an address, it is a LONG. Therefore size = 2.
  839. So here is how we get the RastPort address of a window.
  840.  
  841. wind=GetWindow('My Window',,,,,,,,)
  842. rastport=PEEK(wind,50,2)
  843.  
  844.    These 2 do nothing if address is a null pointer. Since POKE can modify
  845. memory directly, do not use it unless you know what you're doing. Here are
  846. some other common uses for PEEK.
  847.  
  848. /* Get window's Screen address. Could be WorkBench's screen */
  849. screen=PEEK(wind,46,2)
  850.  
  851. /* Get window's ViewPort address. You must first find its screen. */
  852. viewport='' /* assume no viewport */
  853. screen=PEEK(wind,46,2)
  854. IF screen > '' THEN viewport=screen+44
  855.  
  856. /* Get Screen's ViewModes (as described in GetScreen). Note that this is a WORD size */
  857. modes=PEEK(screen,76,1)
  858. IF modes == 0 THEN SAY 'LoRES mode screen'
  859.  
  860. /* Get Screen's Width and Height */
  861. width=PEEK(screen,12,1)
  862. height=PEEK(screen,14,1)
  863.  
  864. /* Get Window's current Gadget strip address */
  865. gstrip=PEEK(wind,62,2)
  866.  
  867. /* Get Window's current LeftEdge, TopEdge, Width and Height */
  868. leftedge=PEEK(wind,4,1)
  869. top=PEEK(wind,6,1)
  870. width=PEEK(wind,8,1)
  871. height=PEEK(wind,10,1)
  872.  
  873. /* Get Window's current PenA #, PenB #, and DrawMode. These are BYTEs. You */
  874. /* must first find the window's Rastport. */
  875. rastport=PEEK(wind,50,2)
  876. penA=PEEK(rastport,25,0)
  877. penB=PEEK(rastport,26,0)
  878. drawmode=PEEK(rastport,28,0)
  879.  
  880.  
  881. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  882. 25) RedrawWind()
  883.  
  884. err = RedrawWind(window,flags)
  885.  
  886.    Can be used to redraw the window's gadgets, window frame, and set the
  887. mouse pointer.
  888.  
  889. Flags: (add up the ones you want)
  890. 1 = Draw a regular mouse pointer
  891. 2 = Draw a Wait pointer
  892. 4 = Redraw window frames
  893. 8 = Refresh the Gadgets
  894. 16 = Blank the mouse pointer
  895.  
  896.  
  897. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  898. 26) FBox()
  899.  
  900. err=FBox(window,x1,y1,x2,y2)
  901.  
  902.    x1 = upper left x coord (default = inside of left border)
  903.    y1 = upper left y coord (default = below title bar)
  904.    x2 = lower right x coord (default = inside of right border)
  905.    y2 = lower right y coord (default = above bottom border)
  906.  
  907.    This is used to draw a filled box where x1 and y1 are the coordinates of
  908. the upper left corner of the box, and x2 and y2 are the coordinates of the
  909. lower right corner of the box. These values are in pixel offsets from the
  910. upper left corner of the window (where x=0, y=0). This function clips the
  911. values to within the window borders. It also checks that x1 < x2, and y1 < y2,
  912. swapping the coordinates if necessary. If window='', does nothing.
  913.    This draws the box using the current PenA and DrawMode for the window.
  914. See SetDraw().
  915.    Note that supplying no args makes a box as large as the window. Also, if
  916. you set PenA to the desired background color #, and drawmode to JAM1 or JAM2,
  917. then you can clear the entire window. Note that this can erase the gadgets as
  918. well, so you should RedrawWind().
  919.  
  920.  
  921. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  922. 27) Line()
  923.  
  924. err=Line(window,origX,origY,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6)
  925.  
  926.    origX = x coord of where to start the line (default = use current x position)
  927.    origY = y coord of where to start the line (default = use current y position)
  928.    x1 = the x coord of the first point to which to draw
  929.    y1 = the y coord of the first point to which to draw
  930.    x2 = the x coord of the second point to which to draw
  931.    y2 = the y coord of the second point to which to draw
  932.    etc
  933.  
  934.    This function draws a series of lines (using the current pens and drawmode).
  935. The start of the line is at origX, origY. Then, the next two args define where
  936. to draw to. Subsequent args define further points to draw lines to. When there
  937. are no more args, the line drawing stops. You can draw up to 6, connected line
  938. segments with each call to this function. Note that you can draw even more
  939. connected line segments by several, subsequent calls to Line(). Don't specify
  940. a new origX or origY (ie just leave an empty comma) and drawing will continue
  941. from the last point. You can draw a single line segment by only giving origX,
  942. origY, x1, and x2. You can draw an unfilled box using this function as well.
  943.  
  944.  
  945. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  946. 28) Pixel()
  947.  
  948. penNum=Pixel(window,y,x,operation)
  949.  
  950.    x = the x coord of the point (default = current mouse x)
  951.    y = the y coord of the point (default = current mouse y)
  952.    operation = 0 for ReadPixel, 1 for WritePixel
  953.  
  954.   This can be used to change the specified pixel to the PenA color (if
  955. operation=1), or to find out the pen number of the specified pixel (operation
  956. =0)
  957.  
  958.  
  959. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  960. 29) Input()
  961.  
  962. response=Input(window,reqdef,charLimit,prompt,init)
  963.  
  964.     This is a routine which allows you to get string input from the user via
  965. the window title bar. It is a handy alternative to a string gadget since it
  966. displays the prompt, gets the input, and restores the title bar without alter-
  967. ing your window display. It is ideal for getting string input without needing
  968. room in the window for a string gadget, or opening another window with a string
  969. gadget inside.
  970.     The user can cursor about the title bar, inserting, deleting chars, and use
  971. CTRL-x to clear the input.
  972.     This returns a NULL string if the user enters no input or presses the ESC
  973. key.
  974.     This also filters out any control characters, and uses the system keymap.
  975.     NOTE: Your font will be changed to Topaz 8 for this call.
  976.  
  977.    window    - the window title bar to use
  978.    reqdef    - a reqdef (gotten via GetReq)
  979.    charLimit - the number of characters the user can type before auto-return
  980.                (ie also the max # of characters that your string will contain)
  981.    prompt    - the prompt to display
  982.    init      - any initial input for the user to edit (must be less than
  983.                charLimit)
  984.  
  985.  
  986. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  987. 30) MsgOne() and MsgThree()
  988.  
  989. YesNo = MsgThree(window,string1,string2,string3)
  990. YesNo = MsgOne(window,string)
  991.  
  992.    These two are used to present an automessage to the user. MsgOne() only dis-
  993. plays one string and an OK gadget, and always returns 1. MsgThree() allows
  994. up to 3 lines of text, has an OK and NO gadget (returning 1 and 0 respectively)
  995. and centers the 3 lines in the requester. The 2nd or 3rd line can be omitted
  996. by passing null arguments for them.
  997.  
  998.  
  999. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  1000. 31) Title()
  1001.  
  1002. err = Title(window,reqdef,string1,string2)
  1003.  
  1004.    This changes the window title bar to string1 with string2 appended. This
  1005. can be used instead of the two autorequester routines. If all you need to do
  1006. is post some error message without needing a reaction from the user, this
  1007. method frees the user from needing to select some requester's OK or CANCEL to
  1008. continue. The original window title is saved so that a subsequent Title() with
  1009. no string1 argument can restore the title, even across multiple calls to
  1010. changing the title bar. Note that this function will overwrite certain reqdef
  1011. fields so that if you use this function, any filename currently in the reqdef
  1012. will be disposed of. Also, if you use this reqdef to obtain a filename, the
  1013. window's original title can no longer be restored via a NULL string1 arg as so:
  1014.  
  1015. err = Title(window,reqdef,)
  1016.  
  1017.  
  1018. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  1019. 32) IFFLoad() and IFFSave()
  1020.  
  1021.    These two load an IFF ILBM picture into a window, and save a window's
  1022. rastport as an ILBM file, respectively. They both require the dissidents'
  1023. ilbm.library to be in your LIBS: drawer. Without this library, a null pointer
  1024. is returned.
  1025.  
  1026. window=IFFLoad(window,flags,filename)
  1027.  
  1028.   window - the address of the window to be loaded into, or 0 if you want the
  1029.            lib to open a window/screen of the proper size for the ILBM. IFFLoad
  1030.            returns the address of the window (or null pointer if it couldn't
  1031.            open). You are responsible for closing any window and screen that
  1032.            the lib opens for you. Use EndWindow() and EndScreen(). Remember, to
  1033.            get the address of the window's screen, use Peek().
  1034.   flags -  describes how to setup the load as follows:
  1035.  
  1036. 1 = MOUSEFLAG  (set for blank mouse pointer)
  1037. 2 = SCREENFLAG (set for hide screen title bar)
  1038. 4 = COLORFLAG  (set for "Don't use loaded colorMap. Preserve present map.)
  1039. 8 = NOSCALE    (set for "Don't scale a lower res pic to fill a larger bitmap)
  1040. 16 = ADJUSTVIEW (do overscan if larger than standard Intuition view)
  1041. 32 = FORCEPARSE (ignore IFF_DONE and force parsing to continue to end of file)
  1042. 128 = ANIMFLAG (set if an ANIM file. The lib takes care of this one)           
  1043.  
  1044.   filename - the name of the IFF ILBM file to load
  1045.  
  1046.    If an error occurs during load (other than the window not opening), an error
  1047. requester will appear to alert the user. If you let the library open the window
  1048. and screen for you, you must close these yourself later via EndWindow() and
  1049. EndScreen. For example:
  1050.  
  1051.    /* load a picture called blort in current dir. Let lib open window/screen */
  1052. picwind=rxi_IFFLoad(0,1+2+16,'blort')
  1053.    /* Wait for ANY idcmp in this window (i.e. user click) before closing down */
  1054. spec=rxi_WaitMsg(picwind)
  1055.    /* Get window's Screen address */
  1056. picscr=rxi_PEEK(picwind,46,2)
  1057.    /* Close the window and then the screen */
  1058. picwind=rxi_EndWindow(picwind)
  1059. picscr=rxi_EndScreen(picscr)
  1060.  
  1061.  
  1062.  
  1063. window=IFFSave(window,filename)
  1064.  
  1065.    This saves a window's contents as an ILBM file. If window is null, this does
  1066. nothing. It posts an error requester if the save is not good.
  1067.  
  1068.  
  1069. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  1070. 33) Color()
  1071.  
  1072.     This brings up the dissidents color requester so that the user can adjust
  1073. the screen's colors. This requires the dissidents color.library to be in your
  1074. LIBS: drawer. This requester automatically adjusts to the number of colors in
  1075. the screen, and has numerous features. See Color.doc for details, or contact
  1076. dissidents.
  1077.   This function allows you to pass the desired FgPen (i.e. PenA) for the
  1078. gadgets and text. This routine also returns the FgPen that the user has
  1079. selected via the 10 function keys. This is useful for applications that load
  1080. some ILBM picture such that you can't be sure that pen numbers 0 and 1 are
  1081. dissimiliar colors. (The file requester, color palette, menus and other
  1082. graphics usually use PenA=1 and PenB=0.) With similiar color values for these
  1083. 2 entries in your screen's ViewPort's colorTable, your gadgets, menus, etc
  1084. appear to "disappear" into the background because the FgPen's color is too
  1085. close to the BgPen's color. The user can reselect a new FgPen value with the
  1086. color tool's function keys. When this is returned, you should set all affected
  1087. window RastPort's FgPen to this value and set the BgPen to 0 (via SetDraw).
  1088. When you next call Color(), pass the new PenA number. (The first time, pass a
  1089. 1 or if no PenA passed, then it is assumed to be 1.)
  1090.  
  1091. err = Color(screen,PenA)
  1092.  
  1093.    This returns one of the following values:
  1094.  
  1095. a positive number (including 0) = the user selected OK and this is his PenA choice
  1096. -5 = the user selected CANCEL
  1097. -4 = library in use, another application is displaying it
  1098. -3 = passed a null screen address.
  1099. -2 = screen has no depth (planes).
  1100. -1 = color window can't open (probably out of memory). Buy some more.
  1101.  
  1102.  
  1103. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  1104. 34) SetColor()
  1105.  
  1106.    This function allows you to get (or set) the color value of a particular
  1107. pen in your screen's ColorTable. For example, if a screen has a depth of 3,
  1108. then it has 8 color numbers (3 to the 2nd power). We can say that it has 8
  1109. choices to which we can set our FgPen or BgPen (for text and drawing). These 8
  1110. colors each has its own colorvalue, which is a number comprised of 4 bits each
  1111. for red, green, and blue intensities. For example, a colorvalue of 'fff'x would
  1112. be white since all red, green, and blue intensities are equal and max. A strong
  1113. blue would be '00f'x. Of course, ILBM pictures loaded into this screen also
  1114. are limited to using these 8 colors and their values.
  1115.  
  1116. colorvalue=SetColor(screen,colornumber,colorvalue)
  1117.  
  1118.   You pass the screen whose colors you wish to effect. The colornumber is the
  1119. color to effect. So, if your PenB is set to use color number 0, then you can
  1120. change the background color to a new shade by altering the colorvalue for
  1121. colornumber 0. Passing a colorvalue of -1 retrieves the current colorvalue of
  1122. the passed colornumber instead of altering it to a new value. (So, you can
  1123. either set or retrieve color values for your screen's colors).
  1124.  
  1125.  
  1126. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  1127. 35) Print()
  1128.  
  1129.     This uses the dissidents prtspool.library (copy to LIBS:) to print text
  1130. or graphics. You can dump all or part of a window rastport to the printer,
  1131. or print strings (with imbedded printer codes). The printing is spooled so
  1132. that your application returns immediately (if memory permits) while the lib
  1133. handles the print job. (Your macro could even end before the printing is
  1134. complete.) Subsequent printing is queued and handled by the lib if the printer
  1135. is in use. The preferences printer settings are used (ie color, printer name,
  1136. port, etc). If not enough memory to spool, your macro will halt (with a WAIT
  1137. pointer) until printing is complete. The user can abort at that time by press-
  1138. ing the RIGHT MOUSE BUTTON while holding the ALT key.
  1139.     This routine can also be used to abort all current print jobs by setting
  1140. the ABORT flag.
  1141.  
  1142. err = Print(window, flags, extraCopies, data1, data2, data3, data4)
  1143.  
  1144. flags are: (Add up the ones that you desire)
  1145. ABORT     = 512 (Abort all queued print jobs)
  1146. BWFLAG    = 256 (For Graphics, when any requesters are presented, make PenA
  1147.                  and PenB B+W temporarily.)
  1148. GRAPHICS  = 64 (Print Graphics instead of Text)
  1149. RAWWRITE  = 32 (for Text, don't translate printer codes or characters)
  1150. NONEWLINE = 16 (for Text, don't force NEWLINE at end of each Print)
  1151.  
  1152.   If you want to dump the window rastport, set the GRAPHICS flag. Then data1
  1153.   and data2 are the coords of the upper left corner of the area to print, and
  1154.   data3 and data4 are the lower right corner coords (ie x1,y1,x2,y2). See
  1155.   FBox() for an example of defining coords. The defaults are the same as in
  1156.   FBox() (so if you don't specify the coords, you get the full rastport).
  1157.   The BWFLAG is useful if you don't know whether your PenA and PenB are
  1158.   similiar shades. If they are, any requesters will be indistinguishable
  1159.   from the background. If you encounter this situation, (especially if you're
  1160.   loading ILBMs), you should set this flag.
  1161.  
  1162.   If printing text, don't set GRAPHICS. Then, data1 is the string to print.
  1163.   The subsequent args are ignored. The lib will force a NEWLINE at the end of
  1164.   every Print(). If you don't want this, set NONEWLINE. You must then send
  1165.   your own newline character (16) to flush the output when you desire a new
  1166.   line. Normally, any imbedded printer escape codes (such as italics on, etc)
  1167.   will be translated to the proper codes for your printer. If you wish no
  1168.   translation of characters (ie especially for plotter control), set RAWWRITE.
  1169.   With RAWWRITE, what you send to Print() is exactly what gets shipped out.
  1170.  
  1171.   extraCopies is the number of extra copies beyond 1 that you desire. (ie pass
  1172.   a 0 if you only want the initial dump).
  1173.  
  1174.   If you want to ABORT current printing, just set the ABORT flag. extraCopies
  1175.   and data args are not needed.
  1176.  
  1177.  
  1178. «««««««««««««««««««««««« FILE/STRING REQUESTER SECTION »»»»»»»»»»»»»»»»»»»»»»»
  1179. 36) File/String Requester
  1180.  
  1181.     Here are the functions that pertain to using the file requester, and string
  1182. requesters. Consult disReq.doc for a user's view of how the file requester
  1183. works. Consult disReq_programmer.doc for a more in-depth discussion of the
  1184. disreq library which has the ability to be used for filename selection, as well
  1185. as displaying a list of your own strings (limit 200 chars each). It can do
  1186. multiple selections, reports on whether a file exists and whether it is a dir,
  1187. can do info suppression, pattern matching, display mounted devices (menu
  1188. button), customizable by the user via the 10 function keys, WB pattern
  1189. matching, etc.
  1190.  
  1191. ******************************************************************************
  1192. reqdef = GetReq()
  1193.  
  1194.     This returns the address of a ReqDef structure which is passed to several
  1195. other lib routines. You must get one of these once before using any routine
  1196. requiring a ReqDef. Note that the ReqDef's pens are set to defaults, but you
  1197. may wish to change these using POKE.
  1198.  
  1199.  
  1200. ******************************************************************************
  1201. reqdef = EndReq(reqdef)
  1202.  
  1203.     This frees the ReqDef structure after you are done using any requester
  1204. routines. It also frees any list and locks attached to the ReqDef.
  1205.  
  1206.  
  1207. ******************************************************************************
  1208. path = ReqWindow(reqDef,title,flags,gadgmask,extension,path,obj-type,tooltypes,screen)
  1209. path = ReqNW(reqDef,title,flags,gadgmask,extension,path,obj-type,tooltypes,window,x,y)
  1210.  
  1211.    These present the file/string requester to the user, allowing him to make
  1212. his selection, and then returns the entire selected path (ie directory and
  1213. filename), or '' if CANCEL was selected (or some error occurred). An Error
  1214. could result from the requester being unable to open (not enough mem).
  1215.  
  1216.     NOTE: Your font will be changed to Topaz 8 for this call.
  1217.  
  1218. the args are:
  1219.   the reqdef address (as returned by GetReq)
  1220.   the window title (or '' if none)
  1221.   the ReqDef flag settings (if no arg, these are not changed)
  1222.   the extension string to match (or '' if none) 29 chars MAX
  1223.   the initial path (could be a dir or filename). (If no arg, this is not changed)
  1224.       For STRING_MODE, the string to initially set in the Name String Gadget
  1225.   the gadgmask for removing/adding default gadgets to the requester
  1226.   the obj-type is the WB object to match where 1 = PROJECT and 2 = TOOL (no arg for ANY)
  1227.   the tooltypes string is for WB pattern matching (or no arg for none)
  1228.   the window (or screen if ReqWindow) upon which to open the requester
  1229.   x,y are the upper left coordinate where the requester is to open (ReqNW) If
  1230.       either of these (or both) are set to -1, then the req is automatically
  1231.       centered in the window
  1232.  
  1233.   The difference between ReqWindow() and ReqNW() is that ReqNW() requires you
  1234. to have a window open. ReqWindow() opens on the passed screen (if 0, then that
  1235. means WorkBench).
  1236.  
  1237.   Here are the numbers to specify for the ReqDef Flags. Simply add up the ones
  1238. you want:
  1239. 1  = ADD_ME (When the user types a string into the name gadget that isn't
  1240.             already in the SELECT BOX list, it is automatically added.)
  1241. 2  = FILTER_STANDARD (Remove libs:, s:, c:, devs:, l:, and FONTS: from the list
  1242.             of assigns).
  1243. 4  = FILTER_RAWCTRL (For use with title bar input, filters control chars from
  1244.             the returned string).
  1245. 8  = TITLE_CHANGED (Used by the Title function)
  1246. 16 = WBENCH_MATCH (Match ObjectType and ToolTypes string)
  1247. 32 = MATCH_OBJECTTYPE    (Don't ignore ObjectType. WBENCH_MATCH must also be set)
  1248. 64 = NO_ALPHA (Don't alphabetize the list of filenames/strings)
  1249. 128 = NO_CARE_REDRAW (Does not refresh the list of filenames when first opened)
  1250. 256 = USE_DEVICE_NAMES    (Displays the drives using AmigaDOS device names like DF0)
  1251. 512 = NO_ASSIGNS (Exclude logical assigns for the disk/volume name list)
  1252. 1024 = DOUBLECLICK_OFF (Double-clicking on a filename doesn't end the requester)
  1253. 2048 = MULTIPLE_SELECT (Multiple filename/string selection)
  1254. 4096 = INFO_SUPPRESS (No .info files displayed)
  1255. 8192 = EXTENSION_MATCH (If you want an extension match. You must specify the string)
  1256. 16384 = SHOW_DISKS (Display disk/volume names instead of filenames)
  1257. 32768 = STRING_MODE (Use the requester to display a custom list of strings
  1258.         unrelated to disk filenames)
  1259.  
  1260.   Note that if you pass no arg for flags, then the flags settings will remain
  1261. the same as the last time that the ReqDef was used. (The very first time that
  1262. the ReqDef is used, all flags are clear).
  1263.  
  1264.    The STRING_MODE flag is used to display a requester with a list of your own
  1265. strings. You use AddReq() to create the list of strings. Then, ReqNW() or
  1266. ReqWindow() displays the list to the user and returns his selected string, or
  1267. '' if CANCEL is selected (or an error occurred). An error could occur because
  1268. the requester was unable to open (low on mem). If using ReqWindow, try ReqNW
  1269. (if you already have a window open). For FILENAME MODE, ReqNW always succeeds.
  1270.    For STRING_MODE, replace the path arg with the desired string to be placed
  1271. in the Name Gadget. If no arg, then the gadget keeps its previous text.
  1272.  
  1273.    Note that only the DOUBLECLICK_OFF, NO_ALPHA, MULTIPLE_SELECT, ADD_ME and
  1274. FILTER_RAWCTRL flags are effective in conjunction with STRING_MODE.
  1275.    Note that if you use one ReqDef for both filename and string reqs, you
  1276. should EmptyReq() before calling ReqNW(), and you will have to EmptyReq()
  1277. and remake your custom string list each time before using STRING_MODE. You
  1278. could of course GetReq() two ReqDefs and use one for filename and the other for
  1279. STRING_MODE.
  1280.    Also note that this function clears any RMBTRAP of your window, so you
  1281. should reset that via ModIDCMP() if desired.
  1282.    For filename selection, when this routine returns you should check the
  1283. ReqDef's FileSize field and the first byte of the Filename field to see whether
  1284. the user has chosen a filename, and whether it already exists. This allows
  1285. you to protect against overwriting existing files, or trying to load non-
  1286. existant files. If the user has chosen a file, then the first byte of Filename
  1287. is not 0. If the file exists, then FileSize (LONG) is not 0; it is the size
  1288. of the file.
  1289.  
  1290. choose=rxi_Peek(ReqDef,4,0)
  1291. IF choose > 0 THEN SAY 'User selected a file'
  1292. IF choose == 0 THEN SAY 'User selected a directory only, or no selection at all'
  1293.  
  1294. size=rxi_Peek(ReqDef,204,2)
  1295. IF size == 0 THEN SAY 'This filename does not exist'
  1296. IF size > 0 THEN SAY 'This file exists and it is 'size' bytes.'
  1297.  
  1298.    If you're about to save a file, you would also want to compare the ReqDef's
  1299. FreeBytes (which tells how much room is on the chosen disk) against the number
  1300. of bytes that you intend to write to the disk. If you're going to overwrite an
  1301. existing file, don't forget to add FileSize to FreeBytes before you compare.
  1302.  
  1303. /* Let's say that I want to write 30 bytes using the returned filename. */
  1304. /* I presented the req to the user and he made his selection. I got the */
  1305. /* size, and checked to see if the user made a selection of a file (not dir). */
  1306. numOfbytes=30
  1307. diskspace=rxi_Peek(ReqDef,200,2)
  1308. diskspace=diskspace+size
  1309. IF numOfbytes < diskspace OR numOfbytes == diskspace THEN DO
  1310.  /* write the data */
  1311. END
  1312.  
  1313.     For STRING_MODE, the FileSize field contains the ID number of the string
  1314. that the user selected (or the last string selected with MULTIPLE_SELECT). This
  1315. will be -1 if the string is not one of the ones that you presented in the list
  1316. (ie he typed his own string into the Name Gadget). Note that removing the
  1317. Name gadget makes the latter scenario impossible.
  1318.  
  1319.     For extension, you should specify the EXTENSION_MATCH flag as well as
  1320. specifying a string. The string can contain multiple extensions, separated by a
  1321. /. For example, the string '.c/.asm/picture' will filter out all files except
  1322. those that end in .c, .asm, or picture. You are limited to 29 chars. Extension
  1323. doesn't apply to STRING_MODE.
  1324.  
  1325.     The GadgMask arg allows you to remove/add certain default gadgets from the
  1326. requester. For example, let's say that you wanted to bring up a string
  1327. requester without a Name gadget, so that the user had to choose one of the
  1328. displayed choices (instead of entering his own). You can elect to remove the
  1329. name gadget by setting the GadgMask arg appropriately. Here are the values to
  1330. remove certain gadgets: (add up the values)
  1331.  
  1332. DISK string gadget    1
  1333. DRAWER string gadget    2
  1334. NEXT DISK gadget    4
  1335. NAME string gadget    8
  1336. SCROLL (PROP) gadget    16
  1337. DOWN (arrow) gadget    32
  1338. UP (arrow) gadget    64
  1339. SELECT BOX gadget    128
  1340. OK gadget        256
  1341. CANCEL gadget        512
  1342.  
  1343.     Note that removing the SELECT BOX doesn't remove the list of strings. It
  1344. just makes it so that the user can't select a name by clicking on it STRING
  1345. MODE automatically removes the DISK and DRAWER string gadgets, and NEXT DISK
  1346. gadget.
  1347.     If using STRING MODE, you also have the option of adding a Special Gadget
  1348. to the window (where the NEXT DISK appears in FILENAME MODE) labeled "Delete".
  1349. When the user selects this, any selected (highlighted) strings in the SELECT
  1350. BOX are deleted from the list. In combination with ADD_ME, this allows the user
  1351. to add and remove strings from the list while the requester is displayed.
  1352. Add the following value to your gadgmask arg:
  1353.  
  1354. Add DELETE gadget    32768
  1355.  
  1356.  
  1357. *********************************************************************
  1358. ReqString=AddReq(ReqDef,ID,string)
  1359.  
  1360.   This adds a ReqString (i.e. another item) to a ReqDef's list. Note: set the
  1361.   ReqDef's NO_ALPHA if desired before using this function.
  1362.  
  1363. args are:
  1364.   the ReqDef address (as returned by GetReq)
  1365.   ID is any number you want associated with the string (ie not a string variable)
  1366.   string is the string to be added and displayed
  1367.  
  1368.  
  1369. **************************************************************************
  1370. error=EmptyReq(ReqDef)
  1371.  
  1372.   Clears out any previous list in the ReqDef.
  1373.  
  1374.  
  1375. **************************************************************************
  1376. error=ClearReq(ReqDef)
  1377.  
  1378.   Doesn't actually clear the list. It just "de-selects" all previously selected
  1379. strings. This is used to clear selections after using MULTIPLE_SELECT.
  1380.  
  1381.  
  1382. **************************************************************************
  1383. error=DelReq(ReqDef,string)
  1384.  
  1385.   Finds the string in the ReqDef's list, and removes it.
  1386.  
  1387.  
  1388. ***************************************************************************
  1389. string=FirstReq(ReqDef)
  1390.  
  1391.   Returns a NULL string '' if no more selected strings in the list. Otherwise,
  1392.   returns the next selected string. Must be used once before calling
  1393.   NextReq(). NextReq() is the same as FirstReq(), but used for subsequent
  1394.   calls. These are used to locate all of the selections one at a time after
  1395.   MULTIPLE_SELECT. See the ReqDef.doc for details about MULTIPLE_SELECT.
  1396.  
  1397.  
  1398. **************************************************************************
  1399. ID=FindReq(ReqDef,string)
  1400.  
  1401.  Returns -1 if string is not in the list. Otherwise, returns the ID associated
  1402.  with string.
  1403.  
  1404.  
  1405. **************************************************************************
  1406. path=GetPath(ReqDef,filename)
  1407.  
  1408.   If filename is not NULL '', then this is copied to the ReqDef's filename
  1409.   buffer. Otherwise the filename is left as the user last selected. This
  1410.   returns the last selected path (ie disk:drawer/filename) spec. Useful for
  1411.   reconstructing the entire path when retrieving MULTIPLE_SELECT. Note that
  1412.   this doesn't bring up the requester.
  1413.  
  1414.  
  1415. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  1416. A) Demo scripts
  1417.  
  1418.   There are several demo scripts to show you how to use various aspects of the
  1419. library. Some are rather simple, others more complex.
  1420.   The first thing that you need to learn is how to open a window. Wind.rexx
  1421. does just that on WorkBench (with default IDCMP), then waits for ANY default
  1422. user input such as a MOUSEBUTTON or CLOSEWINDOW, and closes the window.
  1423.   Screen.rexx is almost the same except it opens a screen, and then opens the
  1424. window on that screen.
  1425.   Next, examine the text display functions. Text.rexx shows you how to print
  1426. text to a window. TextModes.rexx shows the effects of printing with different
  1427. pens and DrawModes, as well as shows how to set bold, italics, and underline
  1428. of the current font.
  1429.   Now, look at the first instance of a minimal IDCMP loop, IDCMP.rexx. This
  1430. script just prints out all received events until CLOSEWINDOW. Note how I use
  1431. the PARSE command to break up the IDCMPspec into the 4 separate components.
  1432.   Next, you're ready to look at Menus.rexx which shows you how to setup a menu.
  1433.   Msg.rexx and Msg3.rexx show how to post some autoRequesters in a window.
  1434.   Peek.rexx shows how to use Peek().
  1435.   At this point, you're ready for Gadg.rexx. This script details several
  1436. features of the lib's gadget handling. Study this script carefully as it shows
  1437. how to setup a PROP, STRING, and BOOL gadget. Also, I start to do some things
  1438. inside the IDCMP loop which is where all of your work will be done.
  1439.   Box.rexx shows how to draw a filled box, and demos a use for this. Line.rexx
  1440. demos using the Line() function to draw an unfilled box.
  1441.   TimeOut.rexx demos the automatic timeout of WaitMsg(). Observe the script
  1442. running for several seconds. Note how this feature lets me do something without
  1443. intervention from the user.
  1444.   Keys.rexx shows how to get input from the keyboard. It just prints each key
  1445. that you press, including function, cursor, and help keys. Note that I had to
  1446. modify the IDCMP of the window since RAWKEY is not one of the defaults. I
  1447. could have just specified the IDCMP when I called GetWindow() instead of
  1448. passing a null argument then, but I wanted to show you how to use ModIDCMP().
  1449.   Input.rexx shows how to get a user input string from the window title bar,
  1450. which is a handy alternative to throwing up a string gadget just to get a
  1451. string, then removing it.
  1452.   Now, let's look at the file requester. ReqDef.rexx opens the file requester
  1453. 3 times. Once with INFO_SUPPRESS (no .info files displayed), once only dis-
  1454. playing files that end in ".library" or ".device" (by using EXTENSION_MATCH),
  1455. and the last time it only displays WorkBench tools (ie programs, not data
  1456. files, that have icons.) There are more things that you can do with this
  1457. requester. Multiple.rexx demos being able to select multiple filenames. When
  1458. the requester is open, you can select several filenames (selecting an already
  1459. selected name "unselects" it). This script then uses other functions to print
  1460. out each one of the selected files.
  1461.   Custom.rexx shows how to use the file requester to display a list of strings
  1462. for selection by the user (STRING_MODE). It also demos removing the Name
  1463. gadget, and using ADD_ME and the Delete Gadget.
  1464.   ILBM.rexx shows how to load an ILBM picture (letting the lib open a window
  1465. for it). Of course, you could load into an already open window. This script
  1466. also shows how to trap MENU MOUSEBUTTON events (ie Intuition no longer uses
  1467. this button to display menus. Now, I receive MENU DOWN and MENU UP MOUSEBUTTON
  1468. events.) Actually, I never receive any UP MOUSEBUTTONS because I never set the
  1469. GIMME_UP extraIDCMP flag for the window. This script also brings up the color
  1470. requester if you press the menu button after the picture is loaded.
  1471.  
  1472.  
  1473. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  1474. B) Rexx Error Handling
  1475.  
  1476.    The Rexx server's function library facilities were obviously not labored
  1477. over when the server was written. The handling of error returns from a func-
  1478. tion library causes the complete abort of the Rexx macro script (to the best
  1479. of my knowledge). If the Rexx function library allowed the macro to allocate
  1480. resources (such as this lib allows you to open windows, etc), then there is
  1481. no way for your macro to free the resources after Rexx stops it. For this
  1482. reason, the lib always returns success to the server, but null pointers when
  1483. an error occurs. All lib routines that operate on structures do nothing (ie are
  1484. safe) if passed a null pointer. This makes it possible for you to plod on if
  1485. an error occurs so that you can later free any resources that were allocated,
  1486. but also means that part of your macro may end up doing nothing. If there
  1487. wasn't enough memory to even open the window, an entire script could even do
  1488. nothing!!! Alas, I decided to forego returning error messages then have you
  1489. deal with allocated resources that can't be recovered until a reboot. Now, if
  1490. only this aspect of ARexx had been better implemented...
  1491.    The only error that may result in aborting of the Rexx script is if there is
  1492. not enough memory to even return a result to Rexx (or if you have an in-
  1493. correctly written script).
  1494.  
  1495.  
  1496. «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
  1497. C) Final remarks
  1498.  
  1499.    Each of the lib's function names begins with 8, unique characters. If you're
  1500. writing a Rexx macro that has to be as "tight" as possible, you may call any
  1501. lib function using only the first 8 letters. For example,
  1502.  
  1503. window=rxi_GetW(,,,,,,,,,)
  1504.  
  1505. opens a default window on WorkBench. You also can eliminate all extra spaces
  1506. (like I did in the above example), and remove comments and blank lines from
  1507. the script.
  1508.    This library is meant to enhance the amiga's ARexx package by Bill Hawes,
  1509. allowing scripts to interact with a user in an Intuition environment. As such,
  1510. it offers the ability to create a completely interactive Rexx script which can
  1511. function as its own application program.
  1512.    The implementation of these functions reflects my own perception of what
  1513. some programmer (i.e. me) is likely to need. The most important considerations
  1514. were general functionality, speed, and size. By general functionality, I mean
  1515. that it was designed to let you interact with Intuition in a way that makes
  1516. it possible to do many typical things, but the esoteric (and fancy) manipula-
  1517. tion that other high level languages offer was excluded. Otherwise, the lib
  1518. would be much too big and slow, particularly for a SLOW interpreted language
  1519. like Rexx. It was written completely in 68000 with "aggressive optimization"
  1520. techniques. Consequently, its small size (about 7K) and speed help extend the
  1521. Rexx command set without imposing too severe an overhead.
  1522.    It may be that I implemented something in a manner which better suits my
  1523. needs than your own. For this reason, I welcome feedback from anyone experi-
  1524. menting with the library. Don't just call when you have a problem. If you have
  1525. ideas for additions, you may be able to convince me that it is a viable pro-
  1526. ject. Otherwise, I'll assume that this lib suits your needs as well.
  1527.